package com.dabaozhan.modules.wx_app.service.impl;

import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dabaozhan.common.utils.Utils;
import com.dabaozhan.modules.wx_app.dao.RiskMapper;
import com.dabaozhan.modules.wx_app.entity.QueryListBaseEntity;
import com.dabaozhan.modules.wx_app.entity.RiskEntity;
import com.dabaozhan.modules.wx_app.service.RiskService;

@Service("riskService")
public class RiskServiceImpl implements RiskService{
	
	@Autowired
	private RiskMapper riskMapper;

	@Override
	public RiskEntity getRisk(RiskEntity entity) {
		return riskMapper.getRisk(entity);
	}

	@Override
	public List<RiskEntity> getRiskList(QueryListBaseEntity entity) {
		return riskMapper.getRiskList(entity);
	}

	@Override
	public int addRisk(RiskEntity entity) {
		if(StringUtils.isBlank(entity.getId())){
			entity.setId(Utils.id().toString());
		}
		return riskMapper.addRisk(entity);
	}

	@Override
	public int deleteRisk(RiskEntity entity) {
		return riskMapper.deleteRisk(entity);
	}

	@Override
	public long getRiskCount(QueryListBaseEntity entity) {
		return riskMapper.getRiskCount(entity);
	}

}
